#ifndef __LITTLE_ENDIAN_H__
#define __LITTLE_ENDIAN_H__

#include "linux/types.h"
#include "uapi/linux/swab.h"

static inline uint32_t __cpu_to_be32p(uint32_t *p)
{
	return (uint32_t)__swab32p(p);
}
static uint32_t uint32_t_to_cpup(uint32_t *p)
{
	return __swab32p((uint32_t *)p);
}

static inline uint32_t __arch_swab32(uint32_t x)
{
	uint32_t t;

	t = x ^ ((x << 16) | (x >> 16)); /* eor r1,r0,r0,ror #16 */

	x = (x << 24) | (x >> 8);		/* mov r0,r0,ror #8      */
	t &= ~0x00FF0000;			/* bic r1,r1,#0x00FF0000 */
	x ^= (t >> 8);				/* eor r0,r0,r1,lsr #8   */

	return x;
}

//#define __cpu_to_be32(x) ((uint32_t)__swab32((x)))
//#define uint32_to_cpu(x) __swab32((__attribute__((force)))(uint32_t)(__be32)(x))

static inline uint32_t cpu_to_be32(uint32_t x)
{
	//return __arch_swab32((__attribute__((force)))(uint32_t)(__be32)(x));
	return __arch_swab32((uint32_t)x);
}

static inline uint32_t  be32_to_cpu(uint32_t x)
{
 	//return __arch_swab32((__attribute__((force)))(uint32_t)(__be32)(x));
	return __arch_swab32((uint32_t)x);
}	

#endif
